package com.zmn.plat.persistence.interfaces.channel.generalproduct;

import com.zmn.plat.model.entity.channel.generalproduct.ChannelGeneralProductSwitch;
import com.zmn.plat.model.entity.channel.generalproduct.ChannelGeneralProductSwitchQuery;
import org.apache.ibatis.annotations.Param;

import java.util.List;


/**
 * 渠道通用产品开关表
 * 
 * @author linfeng
 *
 * @since 2020-03-03 10:10:14
 */
public interface ChannelGeneralProductSwitchDao {

    /**
     * 查询
     * @param relateId ID
     * @return
     */
    ChannelGeneralProductSwitch findByKey(Integer relateId);

    /**
     * 根据渠道ID和服务分类ID查询
     * @param channelId
     * @param servCategId
     * @return
     */
    ChannelGeneralProductSwitch findByChannelIdAndServCategId(@Param("channelId") Integer channelId, @Param("servCategId") Integer servCategId);

    /**
     * 查询
     * @param channelId
     * @return
     */
    List<ChannelGeneralProductSwitch> listByChannelId(@Param("channelId") Integer channelId);

    /**
     * 搜索
     * @param query 条件
     * @return
     */
    List<ChannelGeneralProductSwitch> listByQuery(ChannelGeneralProductSwitchQuery query);

    /**
     * 所有数据
     * @return
     */
    List<ChannelGeneralProductSwitch> listAll();

    /**
     * 描述: 查询渠道关联的通用产品服务分类id
     *
     * @param channelId channelId
     * @param status status
     * @return java.util.List<java.lang.Integer>
     * @author jiafei
     * @since 2021/6/29 14:10
     */
    List<Integer> listServCateIdByChannelAndStatus(@Param("channelId") Integer channelId, @Param("status") Integer status);

    /**
     * 更新
     * @param channelGeneralProductSwitch
     * @return
     */
    Integer updateByKey(ChannelGeneralProductSwitch channelGeneralProductSwitch);

    /**
     * 插入
     * @param channelGeneralProductSwitch
     * @return
     */
    Integer insert(ChannelGeneralProductSwitch channelGeneralProductSwitch);

    /**
     * 插入
     * @param channelGeneralProductSwitches
     * @return
     */
    Integer insertBatch(List<ChannelGeneralProductSwitch> channelGeneralProductSwitches);

    /**
     * 删除
     * @param relateId ID
     * @return
     */
    Integer deleteByKey(Integer relateId);

    /**
     * 根据主键IDS删除
     * @param ids
     * @return
     */
    Integer deleteByKeys(@Param("ids") List<String> ids);

    /**
     * 描述: 根据渠道id删除
     *
     * @param channelId 渠道id
     * @return java.lang.Integer
     * @author guoqiao
     * @since 2021/6/9 14:27
     */
    Integer deleteByChannelId(Integer channelId);

    /**
     * 描述: 从旧渠道复制到新渠道
     *
     * @param originalChannelId 原渠道ID
     * @param targetChannelId 新渠道ID
     * @param operator 操作者
     * @return java.lang.Boolean
     * @author guoqiao
     * @since 2021/6/8 13:49
     */
    void copy(Integer originalChannelId, int targetChannelId, String operator);

}
